package com.s59.listener;

import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletContextInitializer;
import org.springframework.web.context.ContextLoaderListener;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * 全局监听，只执行一次
 */
@WebListener
public class Applistener implements ServletContextListener {
    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("项目停止，释放资源");
    }

    @Override
    public void contextInitialized(ServletContextEvent sce) {
        System.out.println("项目启动，初始化全局配置");
    }
}
